<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>demo</title>
  <script type="text/javascript" src="../vue.js"></script>
</head>

<body>
  <div id="app">

  </div>
</body>
<script type="text/javascript">
  Vue.config.productionTip = false;

  Vue.prototype.$bus = " can can need"

  let Count = Vue.extend({
    name: "Count",
    data() {
      return {
        a: 1
      }
    },
    methods: {
      test() {
        console.log(this.$bus);
      }
    },
    template: `<button  @click="test">Count</button> `
  })
  /*
  vue原型对象 
  组件构造函数
  组件
  组件实列

  count的组件实列--count的构造函数---vue的原型对象--object的原型对象--null
  Dd的组件实列--Dd的构造函数---vue的原型对象--object的原型对象--null
  */
  // console.dir(Count, "组件");

  let Dd = {
    name: "Dd",
    data() {
      return {
        Dd: 0
      }
    },
    methods: {
      test() {
        console.log(this.$bus);
      }
    },
    template: `<button  @click="test" >Dd</button>`
  }

  const vm = new Vue({
    el: "#app",
    data() {
      return {}
    },
    //注册组件
    components: {
      Count,
      Dd
    },
    template: `
    <div>
      <Count />
    <Dd />
 
    </div>
    `
  })
</script>

</html>